package com.xiaomazi.acl.controller;

import com.xiaomazi.acl.service.IndexService;
import com.xiaomazi.common.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @program: llxy-parent
 * @description: 基础控制器
 * @author: 小马子
 * @create: 2023-03-14 12:52
 **/
@RestController
@RequestMapping("/admin/acl/index")
public class IndexController {
    @Autowired
    private IndexService indexService;

    @GetMapping("/info")
    public R info(){
        return R.ok().data(indexService.getUserInfo(SecurityContextHolder.getContext().getAuthentication().getName()));
    }

    @GetMapping("/menu")
    public R getMenu(){
        return R.ok().data("permissionList",indexService.getMenu(SecurityContextHolder.getContext().getAuthentication().getName()));
    }
}
